// pages/list/list.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cateItems: [
      {
        cate_id: 1,
        cate_name: "热门",
        ishaveChild: true,
        children:
          [
            {
              child_id: 1,
              name: '钟点工',
            },
            {
              child_id: 6,
              name: '灯具更换',
            },
            {
              child_id: 2,
              name: '厨卫保养',
            },
            {
              child_id: 2,
              name: '企业保洁',
            }
          ]
      },
      {
        cate_id: 2,
        cate_name: "保洁服务",
        ishaveChild: true,
        children:
          [
            {
              child_id: 2,
              name: '日常保洁',
            },
            {
              child_id: 2,
              name: '深度清洁',
            },
            {
              child_id: 2,
              name: '企业保洁',
            },
            {
              child_id: 2,
              name: '擦玻璃',
            },
            {
              child_id: 2,
              name: '新居开荒',
            },
            {
              child_id: 2,
              name: '厨卫保养',
            },
            {
              child_id: 2,
              name: '洗衣机清洁',
            },
            {
              child_id: 2,
              name: '油烟机清洁',
            },
            {
              child_id: 2,
              name: '冰箱清洁',
            },
            {
              child_id: 2,
              name: '皮质家具清洁',
            },
            {
              child_id: 2,
              name: '地板打蜡',
            },
            {
              child_id: 2,
              name: '深度除螨',
            }
          ]
      },
      {
        cate_id: 3,
        cate_name: "维修服务",
        ishaveChild: true,
        children:
          [
            {
              child_id: 3,
              name: '空调维修',
            },
            {
              child_id: 3,
              name: '热水器维修',
            },
            {
              child_id: 3,
              name: '电视机维修',
            },
            {
              child_id: 3,
              name: '冰箱维修',
            },
            {
              child_id: 3,
              name: '洗衣机维修',
            },
            {
              child_id: 3,
              name: '燃气灶维修',
            },
            {
              child_id: 3,
              name: '热水器安装',
            },
            {
              child_id: 3,
              name: '空调安装',
            },
            {
              child_id: 3,
              name: '油烟机安装',
            }
          ]
      },
      {
        cate_id: 4,
        cate_name: "搬家服务",
        ishaveChild: true,
        children: [
          {
            child_id: 4,
            name: '家庭搬家',
          }, 
          {
            child_id: 4,
            name: '企业搬家',
          }, 
          {
            child_id: 4,
            name: '仓储货物搬迁',
          }
        ]
      },
      {
        cate_id: 5,
        cate_name: "保姆月嫂",
        ishaveChild: true,
        children: [
          {
            child_id: 5,
            name: '保姆',
          },
          {
            child_id: 5,
            name: '月嫂',
          },
          {
            child_id: 5,
            name: '育儿嫂',
          },
          {
            child_id: 5,
            name: '老人照料',
          },
          {
            child_id: 5,
            name: '医院陪护',
          },
          {
            child_id: 5,
            name: '钟点工',
          },
          {
            child_id: 5,
            name: '做饭阿姨',
          }
        ]
      },
      {
        cate_id: 6,
        cate_name: "管道维修",
        ishaveChild: true,
        children: [
          {
            child_id: 6,
            name: '浴缸疏通',
          },
          {
            child_id: 6,
            name: '下水道疏通',
          },
          {
            child_id: 6,
            name: '马桶疏通',
          },
          {
            child_id: 6,
            name: '地漏疏通',
          },
          {
            child_id: 6,
            name: '水龙头更换',
          },
          {
            child_id: 6,
            name: '马桶更换',
          },
          {
            child_id: 6,
            name: '灯具更换',
          }
        ]
      },
    ],
    curNav: 2,
    curIndex: 1
  },
  switchRightTab: function (e) {
    // 获取item项的id，和数组的下标值 
    let id = e.target.dataset.id;
    let index = e.target.dataset.index;
    console.log(index)
    this.setData({
      curNav: id,
      curIndex: index,
    })
  },
  start_incon: function (e) {
    var cateid = e.currentTarget.dataset.cateid;
    if (cateid == 1){
      app.navTo('../xjkhintroduce/xjkhintroduce')
    } else if (cateid == 2){
      app.navTo('../xjkhintroduce/xjkhintroduce')
    } else if (cateid == 3) {
      app.navTo('../bxwxjince/bxwxjince')
    } else if (cateid == 4) {
      app.navTo('../familyintroduce/familyintroduce')
    } else if (cateid == 5) {
      app.navTo('../bmintroduce/bmintroduce')
    } else{
      app.navTo('../mtince/mtince')
    }
  },
  //底部
  index: function () {
    app.radTo('../index/index')
  },
  list: function () {
    app.radTo('../list/list')
  },
  order: function () {
    app.radTo('../order/order')
  },
  my: function () {
    app.radTo('../my/my')
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    getApp().editTabBar(); 
 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})